﻿using MediatR;
using S.EliminationOrDath.Domain.Models;
using S.EliminationOrDath.Infrastructure.Interface;
using S.EliminationOrDath.Read.API.Application.Command.SheepDeathCommand;

namespace S.EliminationOrDath.Read.API.Application.CommandHandlers.SheepDeathCommandHandler
{
    public class SheepDeathIdsCommandHandler : IRequestHandler<SheepDeathIdsCommand, List<DeathModel>>
    {
        private readonly ISheepDeathRepository _sheepDeathRepository;
        public SheepDeathIdsCommandHandler(ISheepDeathRepository sheepDeathRepository)
        {
            _sheepDeathRepository= sheepDeathRepository;
        }
        /// <summary>
        /// 根据Id批量查询死亡信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<List<DeathModel>> Handle(SheepDeathIdsCommand request, CancellationToken cancellationToken)
        {
            return await _sheepDeathRepository.GetDeathsids(request.DeathIds);
        }
    }
}
